<form method="post" action="">
    <input type="checkbox" name="hobby[]" value="篮球">篮球
    <input type="checkbox" name="hobby[]" value="足球">足球
    <input type="checkbox" name="hobby[]" value="乒乓球">乒乓球
    <input type="submit" name="sub" value="提交">
</form>
<?php
    header('Content-type:text/html;charset=utf-8');
    if(!empty($_POST['hobby'])) {
        echo "爱好有：";
        $a = $_POST['hobby'];
        foreach ($a as $k => $v) {
//          echo $v."";
            echo $v;
//          var_dump($v);
        }
    }else{
        echo '请选择';
    }


?>